package com.sita.redsun.connector.startup;

import com.sita.redsun.util.AppContexConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.Ordered;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by zhebinwang on 2017/3/28.
 */
@Configuration
@EnableWebMvc
@EnableJms
@ImportResource("classpath*:META-INF/spring/activemq.xml")
@ComponentScan(basePackages = {"com.sita.redsun.mq",
        "com.sita.redsun.connector.service.rest",
        "com.sita.redsun.connector.service.core"

})
public class ConfigBegin extends WebMvcConfigurerAdapter {


    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }


 /*   @Bean
    public ServerManager getConnectorManager() {
        System.out.println("启动");
        ServerManager serverManager= new ServerManager();
        System.out.println("启动0");
        return serverManager;
    }*/

    @Bean
    public AppContexConfig appContexConfig() {
        return new AppContexConfig();
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }





}
